//
//  NeighbouringDetailTableCell.m
//  HeartTravel
//
//  Created by dlios on 15-7-1.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "NeighbouringDetailTableCell.h"

@implementation NeighbouringDetailTableCell

- (void)dealloc{
    
    [_bgView release];
    [_leftImageView release];
    [_titleLabel release];
    [_tipsLabel release];
    [_distanceLabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return  self;
}

- (void)create{
    
    self.bigBgView = [[UIView alloc]init];
    self.bigBgView.backgroundColor = [UIColor grayColor];
//    self.bigBgView.alpha = 0.3;
    [self.contentView addSubview:self.bigBgView];
    [self.bigBgView release];
    
    self.bgView = [[UIView alloc]init];
    self.bgView.backgroundColor = [UIColor whiteColor];
    self.bgView.layer.cornerRadius = 5;
    self.bgView.layer.masksToBounds = YES;
    [self.bigBgView addSubview:self.bgView];
    [self.bgView release];
    
    self.leftImageView = [[UIImageView alloc]init];
    self.leftImageView.backgroundColor = [UIColor blackColor];
    [self.bgView addSubview:self.leftImageView];
    [self.leftImageView release];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.bgView addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.tipsLabel = [[UILabel alloc]init];
    self.tipsLabel.numberOfLines = 2;
    self.tipsLabel.font = [UIFont systemFontOfSize:13];
    [self.bgView addSubview:self.tipsLabel];
    [self.tipsLabel release];
    
    self.distanceLabel = [[UILabel alloc]init];
    self.distanceLabel.textColor = [UIColor grayColor];
    self.distanceLabel.font = [UIFont systemFontOfSize:13];
    [self.bgView addSubview:self.distanceLabel];
    [self.distanceLabel release];
    
}

- (void)layoutSubviews{

    [super layoutSubviews];
    
    self.bigBgView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    
    self.bgView.frame = CGRectMake(10, 2, self.contentView.frame.size.width-20, self.contentView.frame.size.height-4);
    
    self.leftImageView.frame = CGRectMake(5, 5, self.bgView.frame.size.height-10, self.bgView.frame.size.height-10);
    
    self.titleLabel.frame = CGRectMake(self.bgView.frame.size.height, 5, self.bgView.frame.size.width-self.bgView.frame.size.height, (self.bgView.frame.size.height-10)/3);
    
    self.tipsLabel.frame = CGRectMake(self.bgView.frame.size.height, 42, self.bgView.frame.size.width-self.bgView.frame.size.height, (self.bgView.frame.size.height-10)/3);
    
    self.distanceLabel.frame = CGRectMake(self.bgView.frame.size.height, 79, self.bgView.frame.size.width-self.bgView.frame.size.height, (self.bgView.frame.size.height-10)/3);
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
